#pragma once
#include "../../include/types.h"
#include "sleeplock.h"

#define BSIZE 1024 
struct buf {
    int valid;   // has data been read from disk?
    int disk;    // does disk "own" buf?
    uint32 dev;
    uint32 blockno;
    struct sleeplock lock;
    uint32 refcnt;
    struct buf *prev; // LRU cache list
    struct buf *next;
    uint8 data[BSIZE];
  };
  
void binit(void);
struct buf* bget(uint32 dev, uint32 blockno);
struct buf* bread(uint32 dev, uint32 blockno);
void bwrite(struct buf *b);
void brelse(struct buf *b);
void bpin(struct buf *b);
void bunpin(struct buf *b);
  